package com.duobaoyu.dby.supply.job.task.channel;

import com.duobaoyu.dby.channel.adapter.enums.ChannelCodeEnum;
import com.duobaoyu.dby.channel.adapter.enums.biz.message.MessageTypeEnum;
import com.duobaoyu.dby.supply.biz.client.boundary.message.ChannelPullMessageBoundaryClient;
import com.duobaoyu.dby.supply.core.dinger.annotation.DingerTalk;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 渠道售后任务
 *
 * @author fengshaoyu
 * @version 1.0.0
 * @date 2023/9/26 17:33
 */
@Component
@RequiredArgsConstructor
public class ChannelAfterSalesTask {

	private final ChannelPullMessageBoundaryClient channelPullMessageBoundaryClient;
	/**
	 * 售后申请单状态变更消息
	 * 10:申请 20:审核 30:收货 40:处理 50:待用户确认 60:完成 70:取消
	 * 环节在20或40的时候才会有类型变更
	 * applyStep为20或40的时候stepPassType有值
	 * stepPassType:环节通过情况 10, “全部通过” 20, “部分通过” 30, “没有通过”
	 */
	@XxlJob("jdAfterSaleApplyStateChangeJob")
	@DingerTalk(title = "京东售后申请状态变更消息")
	public void afterSaleApplyStateChangeJobHandler() {
		channelPullMessageBoundaryClient.loopPullChannelMessage(ChannelCodeEnum.JD_VOP, MessageTypeEnum.AFTER_SALE_APPLY_STATUS,null);
	}

	/**
	 * 申请单维度售后退款完成消息
	 */
	@XxlJob("jdAfterSaleCompleteOfApplyJob")
	@DingerTalk(title = "京东售后退款完成消息")
	public void afterSaleCompleteOfApplyJobHandler() {
		channelPullMessageBoundaryClient.loopPullChannelMessage(ChannelCodeEnum.JD_VOP, MessageTypeEnum.AFTER_SALE_COMPLE_OF_APPLY,null);
	}

	/**
	 * 震坤行售后状态消息
	 */
	@XxlJob("zkhAfterSaleStatus")
	@DingerTalk(title = "震坤行售后状态消息")
	public void zkhAfterSaleStatusMessage() {
		channelPullMessageBoundaryClient.loopPullChannelMessage(ChannelCodeEnum.ZKH, MessageTypeEnum.AFTER_SALE_APPLY_STATUS,null);
	}

	/**
	 * 壹钱包仅退款消息
	 */
	@XxlJob("oneWalletRefundOnly")
	@DingerTalk(title = "壹钱包仅退款消息")
	public void oneWalletRefundOnly() {
		channelPullMessageBoundaryClient.loopPullChannelMessage(ChannelCodeEnum.ONE_WALLET, MessageTypeEnum.AFTER_SALE_APPLY_STATUS,null);
	}
}

